package com.tngames.angrytunisian.game.core.camera;

import playn.core.Mouse.WheelEvent;

import com.tngames.angrytunisian.game.core.AngryTunisianGame;
import com.tngames.angrytunisian.game.core.AngryTunisianGameEngine;
import com.tngames.angrytunisian.game.core.Constants;
import com.tngames.angrytunisian.game.core.entity.EntityEngine;
import com.tngames.angrytunisian.game.core.splingshot.PeaTest;

public class Camera {

	private EntityEngine engine;

	public Camera(EntityEngine engine) {
		this.engine = engine;
	}

	public void update(float delta) {
		PeaTest pea = AngryTunisianGameEngine.getPea();
//		engine.getWorldLayer().setTranslation(pea.getPosX(), pea.getPosY());
		engine.update(delta);
	}

	public void scroll(WheelEvent event) {
		if (event.velocity() > 0) {
			engine.getWorldLayer().setScale(
					1f / Constants.PHYS_UNIT_PER_SCREEN_UNIT + 20);
		} else {
			engine.getWorldLayer().setScale(
					1f / Constants.PHYS_UNIT_PER_SCREEN_UNIT - 20);
		}
	}

}
